<?php

namespace Home\Model\Ajax;

class PmsReply extends AbstractAjax
{
    // 回复私信
    public function handle()
    {

        $pmsid    = I('request.id', '0', 'intval');
        $send_uid = $this->uid;
        $msg      = I('request.msg', '', 'trim');

        $pms = D('UserPms')->get_pms_one($pmsid);
        if ($pms) {
            $to_uid = $pms['to_uid'];
            if ($pms['to_uid'] == $send_uid) {
                $to_uid = $pms['send_uid'];
            }
            $data = compact('send_uid', 'to_uid', 'msg');
            D('UserPms')->add_pms($data);
        }

        $ajax['status']  = 1;
        $ajax['content'] = "回复成功！";
        return $ajax;
    }
}